package cn.funeralobjects.dictms.entity;

import cn.funeralobjects.common.annotations.*;
import cn.funeralobjects.common.jpa.entity.BaseDelSaltJpaEntity;
import cn.funeralobjects.util.converter.DefaultBooleanShortConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @author FuneralObjects
 * Create date: 2020/6/2 10:54 PM
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@DynamicInsert
@DynamicUpdate
@Entity
@Table(name = "t_dict_value")
public class EDictValue extends BaseDelSaltJpaEntity<Integer> {
    /**
     * 编码
     */
    @Code
    private String code;
    /**
     * 值
     */
    @Name
    private String value;
    /**
     * 是否启用禁用
     */
    @Convert(converter = DefaultBooleanShortConverter.class)
    @Enable
    private Boolean enable;
    /**
     * 是否已经提交
     */
    @Convert(converter = DefaultBooleanShortConverter.class)
    @Commit
    private Boolean commit;
    /**
     * 备注
     */
    private String remark;

    /**
     * 创建日期
     */
    @Temporal(TemporalType.TIMESTAMP)
    @CreateTime
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @UpdateTime
    private Date updateTime;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dict_id", updatable = false)
    private EDict dict;

}
